<template>
	<view class="">
		<uni-popup ref="popup" type="bottom" background-color="#fff" borderRadius="20rpx 20rpx 0 0">
			<view class="popup-wrap">
				<view class="popup-header">
					<view class="popup-header-close" @click="close">
						<image :src="$img_path('/home/icon-close.png')" mode="widthFix"></image>
					</view>
					<view class="popup-header-title">
						<text>疾病选择</text>
					</view>
				</view>
				<view class="popup-content">
					<view class="popup-content-list">
						<scroll-view scroll-y="true" style="height: 100%;">
							<view class="popup-content-list-item" :class="{'item-active': item == skuItem}" v-for="(item, index) in list" :key="index" @click="selectSkuItem(item)">
								{{ item }}
							</view>
						</scroll-view>
					</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		props: {
			list: {
				type: Array,
				default: []
			}
		},
		data() {
			return {
				skuItem: ''
			}
		},
		methods: {
			open(item = '') {
				this.skuItem = item
				this.$refs.popup.open()
			},
			
			close() {
				this.$refs.popup.close()
			},
			
			selectSkuItem(item) {
				this.skuItem = item
				this.$emit("confirm", this.skuItem)
				this.close()
			}
		}
	}
</script>

<style scoped lang="scss">
	.popup-wrap {
		padding: 36rpx 0rpx 68rpx 0rpx;
		box-sizing: border-box;
		// height: 946rpx;
		// position: relative;
		display: flex;
		flex-direction: column;
		
		image {
			width: 100%;
			height: 100%;
		}
	}
	
	.popup-header {
		display: flex;
		align-items: center;
		padding: 0 22rpx;
	}
	
	.popup-header-title {
		flex: 1;
		text-align: center;
		font-weight: bold;
		font-size: 36rpx;
		color: #333333;
	}
	
	.popup-header-close {
		// position: absolute;
		width: 32rpx;
		height: 32rpx;
	}
	
	.popup-content {
		margin-top: 46rpx;
		flex: 1;
		display: flex;
		flex-direction: column;
	}
	
	.popup-content-list {
		height: 850rpx;
	}
	
	.popup-content-list-item {
		height: 96rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-weight: 400;
		font-size: 32rpx;
		color: #999999;
		background: #FFF;
	}
	
	.item-active {
		background: #FFF2F2;
		color: #E72A2A;
		font-weight: bold;
		
	}
</style>